<%-- 
    Document   : sanphamhang
    Created on : Dec 24, 2013, 10:51:52 AM
    Author     : home
--%>

<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page isErrorPage="true"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="t" tagdir="/WEB-INF/tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt" %>

<c:set var="promotion_start" value="${(ngayHienTai >= khuyenMai.getNgayBatDau()) && (ngayHienTai <= khuyenMai.getNgayKetThuc()) && (khuyenMai.getTinhTrangKhuyenMai() == 1)}" ></c:set>
<c:set var="uri" value="${requestScope['javax.servlet.forward.request_uri']}" />

<t:layout>
    <jsp:body>
        <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-top:10px;">
            <tbody>
                <tr>
                    <td class="bgtitle">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0" id="abc">
                            <tbody>
                                <tr>
                                    <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                                            <tbody>
                                                <tr>
                                                    <td width="20">
                                                        <img src="<c:url value="/resources/images/" />mui_ten.gif"></td>
                                                    <td valign="bottom" class="title">
                                                        <div id="danhmucsanpham">
                                                            <!-- Sửa -->
                                                            <h1 class="addtitle">Máy ảnh ${hang.getTenHang()}</h1>
                                                        </div>    
                                                    </td>
                                                    <td width="10" valign="bottom">&nbsp;</td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </td>
                                    
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td valign="top">
                        <img src="<c:url value="/resources/images/" />space.gif" width="1" height="10">
                    </td>
                </tr>
            </tbody>
        </table>
        <table width="98%" border="0" align="center" height="25" cellpadding="0" cellspacing="0">
            <tbody>
                <tr> 
                    <td>Sản phẩm: <strong><c:if test="${hang.getSanPhams().size() > 0}">1</c:if><c:if test="${hang.getSanPhams().size()== 0}">0</c:if></strong> - <strong>${hang.getSanPhams().size()}</strong> trong tổng số: <strong>${hang.getSanPhams().size()}</strong> sản phẩm</td>
                    </tr>
                </tbody>
            </table>

            <table border="0" cellpadding="0" cellspacing="0" align="center">
                <tbody>
                    <!-- 4 cái tr -->
                <c:forEach var="sanpham" varStatus="sanphamCounter" items="${hang.getSanPhams()}" >
                    <c:if test="${sanphamCounter.count % 3 == 1}">
                        <tr>
                        </c:if>
                        <td valign="top">
                            <input name="idprocheck[]" type="hidden" value="259">
                            <table width="260" border="0" align="center" cellpadding="0" cellspacing="0">
                                <tbody>
                                    <tr>
                                        <td> 
                                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                <tbody>
                                                    <tr>
                                                        <td width="11">
                                                            <img src="<c:url value="/resources/images/tbl_pro1.jpg" />" width="11" height="11">
                                                        </td>
                                                        <td background="<c:url value="/resources/images/tbl_pro2.jpg" />">
                                                            <img src="<c:url value="/resources/images/tbl_pro2.jpg" />" width="1" height="11">
                                                        </td>
                                                        <td width="11">
                                                            <img src="<c:url value="/resources/images/tbl_pro3.jpg" />" width="11" height="11">
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                <tbody>
                                                    <tr>
                                                        <td width="11" style="background-image:url('<c:url value="/resources/images/tbl_pro4.jpg" />'); background-repeat:repeat-y; background-position:left top">&nbsp;</td>
                                                        <td>
                                                            <img src="<c:url value="/resources/images/posts.gif" />">&nbsp;
                                                            <!-- Sửa -->
                                                            <a href="<c:url value="/" />" class="linktitlebox">Máy ảnh</a> | 
                                                            <a href="<c:url value="/" />" class="linktitlebox">${sanpham.getHang().getTenHang()}</a>
                                                            <!-- Check -->
                                                            <c:if test="${promotion_start == true}" >
                                                                <span style="float: right; font-weight: bold; margin-top: 2px; color:red">${khuyenMai.getPhanTram()}%</span>
                                                                <img src="<c:url value="/resources/images/sale.png" />" style="float: right;">
                                                            </c:if>
                                                        </td>
                                                        <td width="11" style="background-image:url('<c:url value="/resources/images/tbl_pro5.jpg" />'); background-repeat:repeat-y; background-position:right top">&nbsp;</td>
                                                    </tr>
                                                    <tr>
                                                        <td width="11" style="background-image:url('<c:url value="/resources/images/tbl_pro4.jpg" />'); background-repeat:repeat-y; background-position:left top">&nbsp;</td>
                                                        <td height="270">
                                                            <div align="center">
                                                                <table width="100" border="0" cellpadding="0" cellspacing="0" align="center">
                                                                    <tbody>
                                                                        <tr>
                                                                            <td align="left">
                                                                                <!-- Sửa -->
                                                                                <a style="cursor:hand" href="<c:url value="/" />ChiTietSanPham/${sanpham.getMaSp()}"> 
                                                                                    <img src="<c:url value="/resources/images/product/${sanpham.getHinh()}" />" alt="${sanpham.getTenSanPham()}" width="180" height="260" border="0"> 
                                                                                </a>
                                                                            </td>
                                                                        </tr>
                                                                    </tbody>
                                                                </table>
                                                            </div>
                                                        </td>
                                                        <td width="11" style="background-image:url('<c:url value="/resources/images/tbl_pro5.jpg" />'); background-repeat:repeat-y; background-position:right top">&nbsp;</td>
                                                    </tr>
                                                    <tr>
                                                        <td width="11" style="background-image:url('<c:url value="/resources/images/tbl_pro4.jpg" />'); background-repeat:repeat-y; background-position:left top">&nbsp;</td>
                                                        <td height="50" valign="top">
                                                            <div align="center">
                                                                <h3 style="margin:0px;">
                                                                    <!-- Sửa -->
                                                                    <a style="cursor:hand" href="<c:url value="/" />ChiTietSanPham/${sanpham.getMaSp()}" class="linkblack">${sanpham.getTenSanPham()}</a>
                                                                </h3>
                                                                <span class="<c:if test="${promotion_start == true}" >fontgrayprice</c:if><c:if test="${promotion_start == false}" >fontred</c:if>">
                                                                    <fmt:formatNumber type="number" value="${sanpham.getDonGia()}" /> VNĐ
                                                                </span>
                                                                <br>
                                                                <!-- Check -->
                                                                <c:if test="${promotion_start == true}" >
                                                                    <img src="<c:url value="/resources/images/sale_arrow.png" />" style="position: absolute; margin-top: -11px; margin-left: -60px;">
                                                                    <span class="fontred">
                                                                        <fmt:formatNumber type="number" value="${sanpham.getDonGia()*(100-khuyenMai.getPhanTram())/100}" /> VNĐ          
                                                                    </span>
                                                                    <br>
                                                                </c:if>
                                                            </div>
                                                        </td>
                                                        <td width="11" style="background-image:url('<c:url value="/resources/images/tbl_pro5.jpg" />'); background-repeat:repeat-y; background-position:right top">
                                                            &nbsp;
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                <tbody>
                                                    <tr>
                                                        <td width="11">
                                                            <img src="<c:url value="/resources/images/tbl_pro6.jpg" />" width="11" height="44">
                                                        </td>
                                                        <td background="<c:url value="/resources/images/tbl_pro7.jpg" />" style="padding-bottom:3px">
                                                            <form action="<c:url value="/" />GioHang/Them/${sanpham.getMaSp()}" method="post" style="margin:0">
                                                                <table border="0" align="center" cellpadding="2" cellspacing="0">
                                                                    <!-- Sửa -->
                                                                    <input type="hidden" name="idcth" value="productid">
                                                                    <input type="hidden" name="proname" value="productname">
                                                                    <input type="hidden" name="price" value="price">
                                                                    <input type="hidden" name="poids" value="">
                                                                    <input type="hidden" name="img" value="product_hot_item.image">
                                                                    <tbody>
                                                                        <tr>
                                                                            <!-- Nút chi tiết  -->
                                                                            <td>
                                                                                <a style="cursor:hand" href="<c:url value="/" />ChiTietSanPham/${sanpham.getMaSp()}">
                                                                                    <img src="<c:url value="/resources/images/but-detail.jpg" />" border="0">
                                                                                </a>
                                                                            </td>
                                                                            <td width="2">
                                                                                <img src="<c:url value="/resources/images/space.gif" />" width="2">
                                                                            </td>
                                                                            <!--nut mua-->
                                                                            <td>
                                                                                <c:choose>
                                                                                    <c:when test="${(sanpham.getSoLuongTon() - sanpham.getSoLuongDangMua()) > 0}">
                                                                                        <input type="image" src="<c:url value="/resources/images/but-book.jpg" />"></a>
                                                                                    </c:when>
                                                                                    <c:otherwise>
                                                                                        <span class="fontred">Hết hàng</span>
                                                                                    </c:otherwise>
                                                                                </c:choose>
                                                                            </td>
                                                                        </tr>
                                                                    </tbody>
                                                                </table>
                                                            </form>
                                                        </td>
                                                        <td width="11">
                                                            <img src="<c:url value="/resources/images/tbl_pro8.jpg" />" width="11" height="44">
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </td>
                        <c:if test="${sanphamCounter.count % 3 == 3}">
                        </tr>
                    </c:if>
                </c:forEach>
            </tbody>
        </table>

        <table width="98%" border="0" align="center" height="25" cellpadding="0" cellspacing="0">
            <tbody>
                <tr> 
                    <td>Sản phẩm: <strong><c:if test="${hang.getSanPhams().size() > 0}">1</c:if><c:if test="${hang.getSanPhams().size()== 0}">0</c:if></strong> - <strong>${hang.getSanPhams().size()}</strong> trong tổng số: <strong>${hang.getSanPhams().size()}</strong> sản phẩm</td>
                    </tr>
                </tbody>
            </table>
            <style>
                #danhmucsanpham{
                    position: relative;
                }
                h1.addtitle{
                    font-size:18px;
                    margin:0px;
                    display:inline;
                }
                span#titlecategory {
                    position: absolute;
                    top:-21px;
                }
                #titlecategory a{
                    font-size:11px;
                }
            </style>
    </jsp:body>
</t:layout>
